home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Purity / Purity #42 (1995-01)(PackMAN)(DE)[WB].zip / Purity #42 (1995-01)(PackMAN)(DE)[WB].adf / Includes3v1 / Includes3v1.lha / Hardware / CIA.i < prev    next >
Text File  |  1994-12-04  |  5KB  |  199 lines

  1. {
  2.     CIA.i for PCQ Pascal
  3.  
  4.     registers and bits in the Complex Interface Adapter (CIA) chip
  5. }
  6.  
  7. {
  8.  * ciaa is on an ODD address (e.g. the low byte) -- $bfe001
  9.  * ciab is on an EVEN address (e.g. the high byte) -- $bfd000
  10.  *
  11.  * do this to get the definitions:
  12.  *    extern struct CIA ciaa, ciab;
  13. }
  14.  
  15. Type
  16.  
  17.     CIA = record
  18.     ciapra        : Byte;
  19.     pad0        : Array [0..254] of Byte;
  20.     ciaprb        : Byte;
  21.     pad1        : Array [0..254] of Byte;
  22.     ciaddra        : Byte;
  23.     pad2        : Array [0..254] of Byte;
  24.     ciaddrb        : Byte;
  25.     pad3        : Array [0..254] of Byte;
  26.     ciatalo        : Byte;
  27.     pad4        : Array [0..254] of Byte;
  28.     ciatahi        : Byte;
  29.     pad5        : Array [0..254] of Byte;
  30.     ciatblo        : Byte;
  31.     pad6        : Array [0..254] of Byte;
  32.     ciatbhi        : Byte;
  33.     pad7        : Array [0..254] of Byte;
  34.     ciatodlow    : Byte;
  35.     pad8        : Array [0..254] of Byte;
  36.     ciatodmid    : Byte;
  37.     pad9        : Array [0..254] of Byte;
  38.     ciatodhi    : Byte;
  39.     pad10        : Array [0..254] of Byte;
  40.     unusedreg    : Byte;
  41.     pad11        : Array [0..254] of Byte;
  42.     ciasdr        : Byte;
  43.     pad12        : Array [0..254] of Byte;
  44.     ciaicr        : Byte;
  45.     pad13        : Array [0..254] of Byte;
  46.     ciacra        : Byte;
  47.     pad14        : Array [0..254] of Byte;
  48.     ciacrb        : Byte;
  49.     end;
  50.     CIAPtr = ^CIA;
  51.  
  52.  
  53. Const
  54.  
  55. { interrupt control register bit numbers }
  56.  
  57.     CIAICRB_TA        = 0;
  58.     CIAICRB_TB        = 1;
  59.     CIAICRB_ALRM    = 2;
  60.     CIAICRB_SP        = 3;
  61.     CIAICRB_FLG        = 4;
  62.     CIAICRB_IR        = 7;
  63.     CIAICRB_SETCLR    = 7;
  64.  
  65. { control register A bit numbers }
  66.  
  67.     CIACRAB_START    = 0;
  68.     CIACRAB_PBON    = 1;
  69.     CIACRAB_OUTMODE     = 2;
  70.     CIACRAB_RUNMODE     = 3;
  71.     CIACRAB_LOAD    = 4;
  72.     CIACRAB_INMODE    = 5;
  73.     CIACRAB_SPMODE    = 6;
  74.     CIACRAB_TODIN    = 7;
  75.  
  76. { control register B bit numbers }
  77.  
  78.     CIACRBB_START    = 0;
  79.     CIACRBB_PBON    = 1;
  80.     CIACRBB_OUTMODE     = 2;
  81.     CIACRBB_RUNMODE     = 3;
  82.     CIACRBB_LOAD    = 4;
  83.     CIACRBB_INMODE0     = 5;
  84.     CIACRBB_INMODE1     = 6;
  85.     CIACRBB_ALARM    = 7;
  86.  
  87. { interrupt control register masks }
  88.  
  89.     CIAICRF_TA        = $01;
  90.     CIAICRF_TB        = $02;
  91.     CIAICRF_ALRM    = $04;
  92.     CIAICRF_SP        = $08;
  93.     CIAICRF_FLG        = $10;
  94.     CIAICRF_IR        = $80;
  95.     CIAICRF_SETCLR    = $80;
  96.  
  97. { control register A register masks }
  98.  
  99.     CIACRAF_START    = $01;
  100.     CIACRAF_PBON    = $02;
  101.     CIACRAF_OUTMODE    = $04;
  102.     CIACRAF_RUNMODE    = $08;
  103.     CIACRAF_LOAD    = $10;
  104.     CIACRAF_INMODE    = $20;
  105.     CIACRAF_SPMODE    = $40;
  106.     CIACRAF_TODIN    = $80;
  107.  
  108. { control register B register masks }
  109.  
  110.     CIACRBF_START    = $01;
  111.     CIACRBF_PBON    = $02;
  112.     CIACRBF_OUTMODE    = $04;
  113.     CIACRBF_RUNMODE    = $08;
  114.     CIACRBF_LOAD    = $10;
  115.     CIACRBF_INMODE0    = $20;
  116.     CIACRBF_INMODE1    = $40;
  117.     CIACRBF_ALARM    = $80;
  118.  
  119. { control register B INMODE masks }
  120.  
  121.     CIACRBF_IN_PHI2    = 0;
  122.     CIACRBF_IN_CNT    = CIACRBF_INMODE0;
  123.     CIACRBF_IN_TA    = CIACRBF_INMODE1;
  124.     CIACRBF_IN_CNT_TA    = CIACRBF_INMODE0 + CIACRBF_INMODE1;
  125.  
  126. {
  127.  * Port definitions -- what each bit in a cia peripheral register is tied to
  128.  }
  129.  
  130. { ciaa port A (0xbfe001) }
  131.  
  132.     CIAB_GAMEPORT1    = 7;    { gameport 1, pin 6 (fire button*) }
  133.     CIAB_GAMEPORT0    = 6;    { gameport 0, pin 6 (fire button*) }
  134.     CIAB_DSKRDY        = 5;    { disk ready* }
  135.     CIAB_DSKTRACK0    = 4;    { disk on track 00* }
  136.     CIAB_DSKPROT    = 3;    { disk write protect* }
  137.     CIAB_DSKCHANGE    = 2;    { disk change* }
  138.     CIAB_LED        = 1;    { led light control (0==>bright) }
  139.     CIAB_OVERLAY    = 0;    { memory overlay bit }
  140.  
  141. { ciaa port B (0xbfe101) -- parallel port }
  142.  
  143. { ciab port A (0xbfd000) -- serial and printer control }
  144.  
  145.     CIAB_COMDTR        = 7;    { serial Data Terminal Ready* }
  146.     CIAB_COMRTS        = 6;    { serial Request to Send* }
  147.     CIAB_COMCD        = 5;    { serial Carrier Detect* }
  148.     CIAB_COMCTS        = 4;    { serial Clear to Send* }
  149.     CIAB_COMDSR        = 3;    { serial Data Set Ready* }
  150.     CIAB_PRTRSEL    = 2;    { printer SELECT }
  151.     CIAB_PRTRPOUT    = 1;    { printer paper out }
  152.     CIAB_PRTRBUSY    = 0;    { printer busy }
  153.  
  154. { ciab port B (0xbfd100) -- disk control }
  155.  
  156.     CIAB_DSKMOTOR    = 7;    { disk motorr* }
  157.     CIAB_DSKSEL3    = 6;    { disk select unit 3* }
  158.     CIAB_DSKSEL2    = 5;    { disk select unit 2* }
  159.     CIAB_DSKSEL1    = 4;    { disk select unit 1* }
  160.     CIAB_DSKSEL0    = 3;    { disk select unit 0* }
  161.     CIAB_DSKSIDE    = 2;    { disk side select* }
  162.     CIAB_DSKDIREC    = 1;    { disk direction of seek* }
  163.     CIAB_DSKSTEP    = 0;    { disk step heads* }
  164.  
  165. { ciaa port A (0xbfe001) }
  166.  
  167.     CIAF_GAMEPORT1    = 128;
  168.     CIAF_GAMEPORT0    = 64;
  169.     CIAF_DSKRDY        = 32;
  170.     CIAF_DSKTRACK0    = 16;
  171.     CIAF_DSKPROT    = 8;
  172.     CIAF_DSKCHANGE    = 4;
  173.     CIAF_LED        = 2;
  174.     CIAF_OVERLAY    = 1;
  175.  
  176. { ciaa port B (0xbfe101) -- parallel port }
  177.  
  178. { ciab port A (0xbfd000) -- serial and printer control }
  179.  
  180.     CIAF_COMDTR        = 128;
  181.     CIAF_COMRTS        = 64;
  182.     CIAF_COMCD        = 32;
  183.     CIAF_COMCTS        = 16;
  184.     CIAF_COMDSR        = 8;
  185.     CIAF_PRTRSEL    = 4;
  186.     CIAF_PRTRPOUT    = 2;
  187.     CIAF_PRTRBUSY    = 1;
  188.  
  189. { ciab port B (0xbfd100) -- disk control }
  190.  
  191.     CIAF_DSKMOTOR    = 128;
  192.     CIAF_DSKSEL3    = 64;
  193.     CIAF_DSKSEL2    = 32;
  194.     CIAF_DSKSEL1    = 16;
  195.     CIAF_DSKSEL0    = 8;
  196.     CIAF_DSKSIDE    = 4;
  197.     CIAF_DSKDIREC    = 2;
  198.     CIAF_DSKSTEP    = 1;
  199.